package com.gen.generator.util;

import org.yaml.snakeyaml.Yaml;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

public class YamlUtil {

    @SuppressWarnings("unchecked")
    public static List<Map<String, String>> loadTemplates() throws Exception {
        Yaml yaml = new Yaml();
        try (InputStream in = YamlUtil.class.getClassLoader().getResourceAsStream("application.yml")) {
            Map<String, Object> config = yaml.load(in);
            return (List<Map<String, String>>) config.get("templates");
        }
    }
}
